<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="/static/bootstrap-5.1.3-dist/css/bootstrap.css">
    <script type="text/javascript" src="/static/bootstrap-5.1.3-dist/js/bootstrap.js"></script>
    <title>宠物超市</title>
</head>

<style>
    .card {
        width: 1600px;
        height: 650px;
        background-color: #fffdfd;
        margin-left: 50px;
        margin-top: 40px;
        border-radius: 30px;
        border: none;
        box-shadow: 5px 5px 10px #adabab;
    }

    .operate {
        padding: 20px 40px;
    }

    .operate button {
        border: solid;
        width: 180px;
    }

    table {
        text-align: center;
        vertical-align: middle !important;
        word-wrap: break-all;
        word-break: break-all;
        table-layout: fixed;

        width: 90% !important;
        margin-left: 80px;

    }

    table a {
        color: #2c3034;
        text-decoration: none;

    }

    .content {
        margin-top: -40px;
        display: flex;
        justify-content: space-around;
    }

    .card_goods {
        width: 330px;
        height: 430px;
        border-radius: 15px;
    }

    .card_goods img {
        width: 300px;
        height: 200px;
        margin: 10px 0 5px 15px;

    }

    .caozuo{
        position: absolute;
        bottom: 10px;
    }
    /*.card_goods .status {*/
    /*    margin-top: 20px;*/
    /*}*/

    /*.card_goods .btn {*/
    /*    margin-top: 10px;*/
    /*}*/

    .page {
        height: 50px;
        /*width: 1270px;*/
        /*margin-left: 1400px;*/
        position: fixed;
        bottom: 130px;
        right: 150px;
    }

</style>

<body>
<jsp:include page="static/Page/common/Navbar.jsp"/>
<div class="card">
    <div class="row operate">
        <div class="col-md-2">
            <form action="craft" method="get">
                <button type="submit" class="btn btn-outline-secondary">查看我的购物车</button>
            </form>
        </div>
        <div class="col-md-2">
            <form action="my_orders" method="get">
                <button type="submit" class="btn btn-outline-secondary">查看我的历史订单</button>
            </form>
        </div>

    </div>

    <div class="content">
        <c:forEach items="${goodsList}" var="goods" varStatus="s">
            <div class="card card_goods">
                <img class="card-img-top" src="${pageContext.request.contextPath}/display?photo=${goods.photo}">
                <div class="card-body">
                    <h5 class="card-title">${goods.name}</h5>
                    <div>￥${goods.price}</div>
                    <div>商品描述:${goods.description}</div>
                    <div class="caozuo">
                        <div class="status">
                            <c:if test="${goods.status==1}">
                                <div style="color: green">该商品货源充足，可以购买</div>
                            </c:if>
                            <c:if test="${goods.status==2}">
                                <div style="color: red">该商品暂时无货</div>
                            </c:if>
                        </div>
                        <c:if test="${goods.status==1}">
                            <a href="add_items?page=${pageInfo.pageIndex}&goodid=${goods.id}" type="button"
                               class="btn btn-outline-success">加入购物车</a>
                        </c:if>
                    </div>

                </div>
            </div>


        </c:forEach>
    </div>


    <div class="page">
        <nav aria-label="Page navigation example">
            <ul class="pagination justify-content-between">
                <c:if test="${pageInfo.isLast && falg == null}">
                    <li><a href="market?page=${pageInfo.pageIndex-1}" class="page-link"><span
                            aria-hidden="true">&larr;</span> 上一页</a></li>
                </c:if>
                <c:if test="${pageInfo.isNext && falg == null}">
                    <li><a href="market?page=${pageInfo.pageIndex+1}" class="page-link">下一页 <span
                            aria-hidden="true">&rarr;</span></a></li>
                </c:if>

            </ul>
            <span>第 ${pageInfo.pageIndex} 页/共 ${pageInfo.sumCount} 页</span>
        </nav>
    </div>
</div>

<jsp:include page="static/Page/common/Foot.jsp"/>
</body>
</html>